def get_cookie(cookies):
    return stringToDict(cookies)
def stringToDict(cookies):
    '''
    将从浏览器上Copy来的cookie字符串转化为Scrapy能使用的Dict
    :return:
    '''
    itemDict = {}
    items = cookies.split(';')
    for item in items:
        arr=item.split('=')
        key = arr[0].replace(' ', '')
        value = arr[1]
        itemDict[key] = value
    return itemDict
if __name__ == "__main__":
    print(get_cookie())